apiready = function() {
    seajs.use(['../../V', "../../api", "../../jquery", "../../app", "../../service", "../../dialog"], function(V, $api, $, app, service, dialog) {
        var vm = {
            el: '.container',
            data: {
                withdrawMoney: '',
                shopId: '',
                page: 1,
                yzc_status: 0
            },
            mounted: function() {

            },
            methods: {
                //--返回
                close: function() {
                    api.closeWin();
                },
                //--获取可提现金额
                getWithdrawMoney: function() {
                    var that = this;
                    var yzc_status = api.pageParam.yzc_status ? 1 : 0;
                    app.ajax(service['getWithdrawMoney'], {
                            data: {
                                values: {
                                    shop_code: api.pageParam.shopId,
                                    unionid: $api.getStorage("shop_unionid"),
                                    isWithdraw: 0,
                                    yzc_status: yzc_status
                                }
                            }
                        },
                        function(res) {
                            // var shopCode = res.data.shop_code; // 商店id
                            if (res.code) {
                                api.toast({
                                    msg: res.message,
                                    duration: 2000,
                                    location: 'middle'
                                });

                            } else {
                                that.withdrawMoney = res.data;
                                console.log("数据：" + JSON.stringify(that.withdrawMoney))
                                console.log("获取可提现金额成功!");
                            }
                        }
                    );
                },
                withdraw: function() {
                    var that = this;
                    dialog.alert({
                        title: "确认提现提示",
                        msg: '请确认是否提现',
                        buttons: ['取消', '确定']
                    }, function(ret) {
                        if (ret.buttonIndex == 2) { //确认
                            app.ajax(service['doWithdrawMoney'], {
                                    data: {
                                        values: {
                                            shop_code: api.pageParam.shopId,
                                            unionid: $api.getStorage("shop_unionid"),
                                            yzc_status: 0
                                        }
                                    }
                                },
                                function(res) {
                                    // var shopCode = res.data.shop_code; // 商店id
                                    if (res.code) {
                                        api.toast({
                                            msg: res.message,
                                            duration: 2000,
                                            location: 'middle'
                                        });
                                    } else {
                                        console.log(JSON.stringify(res.data))
                                        console.log("提现成功!");
                                        that.getWithdrawMoney();
                                    }

                                }
                            );
                        }
                    })
                },
                //--打开已提现列表页面
                openAlreadyList: function() {
                    app.openWin('alreadyList', {
                        shopId: this.shopId,
                        yzc_status: this.yzc_status
                    });
                },

            },
            created: function() {
                var that = this;
                this.getWithdrawMoney();
                this.yzc_status = api.pageParam.yzc_status;
            }
        };

        var even = function() {

        };
        var newVue = new Vue(vm);
        even();

    })
}
